Version: 20 February 2015

Data files:

In a browser, open https://www.aeaweb.org/articles.php?doi=10.1257/aer.97.5.1533
Click on "Download Data Set"

List of programs:

Stata programs (run sucessfully in Stata 10 and Stata 13)
00_raw.do - loads raw data
01_newcodes.do - assigns codes to products
02_cleaning.do - limits data to households of interest
03_prices.do - creates price indices
04_demographics.do - creates demographic variables
05_output.do - produces output files 
06_results.do - analyzes 

MATLAB programs (run sucessfully in R2007b)
Make_R.m - processes output files
hdrload.m - dependency for Make_R.m
dataprepnew.m - dependency for Make_R.m

Executable files (run sucessfully on Windows 7)
MCI.exe - calculates MCI for processed output files
glpk_4_40.dll - dependency for MCI.exe

Steps to perform replication:

1. Make folder C:/research/denver/temp and extract denver.zip into C:/research/denver
2. Make folders C:/output/PQ, C:/output/datain, & c:/output/logs
- Extract output.zip into C:/output/
3. In C:/output/, run 00_raw.do
- It should determine store information
- It should convert all units to ounces if possible (sizedes) and determine the number of ounces of all purchases (total_units)
4. In C:/output/, run 01_newcodes.do
- It should assign product categories (modcodes) to goods (good_group)
5. In C:/output/, run 02_cleaning.do
- It should keep households with data in a 24 month period, and chop off all data outside of this window
- It should define a period as a month of data
- It should get rid of products not in ounces
6. In C:/output/, run 03_prices.do
- It should use all households in the sample above to get the average ounce price for each of the goods in each month
- It should drop a product category if there is a not a purchase in every month
- It should drop a household if no expenditures in a period
7. In C:/output/, run 04_demographics.do
- It should create a file of demographic information for each household
- It should create a file of all of the household IDs
8. In C:/output/, run 05_output.do
- WARNING, this creates a lot of files in C:/output/PQ
- It should create:
(1) a P file for each household that contains the monthly prices for each good in each row (same for all households)
(2) a Q file for each household that contains the monthly ounces for each good in each row (different for all households)
(3) 1000 simulated P and Q files for each household - each Q file assigns a uniform random amount of monthly expenditure to each good (in ounces) in each month
9. In C:/output/, run Make_R.m
- WARNING, this creates a lot of files in C:/output/datain
- It should determine:
(1) the Afriat score for each household
(2) the total budget of each household
- It should create the revealed preference relation files (R_ in C:/output/datain) for each household
10. In C:/output/, run MCI.exe
- It should be finding the MCI value (non-normalized) for each household
11. In C:/output/, open results.csv
- Paste the contents of afriat.xls into a column named afriat
- Paste the contents of total_budgets.xls into a column name total_budgets
12. In C:/output/, run 06_results.do
- Should find the actual violation rates for each household and the average rates for each of the 1000 simulations for each household
